<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <button @click="zujian='hello'">hello</button>
        <button @click="zujian='world'">world</button>
        <component :is="zujian"></component>
    </div>
</body>
<script src="./vue.min.js"></script>
<script>
    const vm = new Vue({
        el:"#app",
        data:{
            zujian:"world"
        },
        components:{
            "hello":{
                template:"<div>这是hello组件</div>"
            },
            "world":{
                template:"<div>这是world组件</div>"
            }
        }
    })
</script>
</html>